public class 大数加法 {
    //https://www.nowcoder.com/practice/11ae12e8c6fe48f883cad618c2e81475?tpId=295&tqId=1061819&ru=/exam/oj&qru=/ta/format-top101/question-ranking&sourceUrl=%2Fexam%2Foj%3FquestionJobId%3D10%26subTabName%3Donline_coding_page
    //简单模拟 + 数学
    public String solve (String ss, String tt) {
        // write code here
        char[] s = ss.toCharArray();
        char[] t = tt.toCharArray();
        int ls = s.length - 1;
        int ts = t.length - 1;
        StringBuilder sb = new StringBuilder();
        int add = 0;
        while(ls >= 0 || ts >= 0){
            int n1 = (ls < 0 ? 0 : s[ls--] - '0');
            int n2 = (ts < 0 ? 0 : t[ts--] - '0');
            int sum = n1 + n2 + add;
            add = 0;
            if(sum >= 10){
                add = 1;
                sum %= 10;
            }
            sb.append(sum);
        }
        if(add == 1){
            sb.append(1);
        }


        return sb.reverse().toString();
    }
}
